package influence;

import java.util.HashMap;
import java.util.List;

import action.Action;

import event.Event;

public class InfluenceAggregator {

	
	
	public HashMap<Action, Float> sum(List<Event> currEvents) {
		HashMap<Action, Float> agg = new HashMap<Action, Float>();
		
		// iterate over the events
		for (Event e : currEvents) {
			List<Influence> outputInfluences = e.getOutputInfluences();
			
			for (Influence i : outputInfluences) {
				if (agg.get(i.getAction()) != null) {
					Float curr_scale = agg.get(i.getAction());
					Float new_scale = new Float(curr_scale.floatValue()  + i.getScale());
					agg.put(i.getAction(), new_scale);
				}
				else agg.put(i.getAction(), i.getScale());
			}
		}
		// bucket and sum the influences they desire
		
		// mapping of <ACTION, scalar>
		
		
		return agg;
	}

}
